﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary.Data;
using System.Data;
using ClassLibrary.Entity;

namespace ClassLibrary.DAO
{
    public class TblAboutUsDAO
    {
         private DBService _db = null;
         public TblAboutUsDAO(String ConnectionString)
        {
            _db = new DBService(ConnectionString);
        }
         public DataTable AboutUs_InUp(TblAboutUs aboutUs, int mode)
         {
             DataTable dt = null;
             try
             {
                 dt = _db.ExeSP_DataTable("sp_TblAboutUs_InsUp",
                     new string[] { "@IDAboutUs", "@AboutUs", "@mode" },
                     new object[] { aboutUs.IDAboutUs, aboutUs.AboutUs, mode }, CommandType.StoredProcedure);
             }
             catch (Exception ex)
             {
                 throw ex;
             }

             return dt;
         }

         public DataTable GetAbout_ByID(int id)
         {
             DataTable dt = null;
             try
             {
                 dt = _db.ExeSP_DataTable("select * from TblAboutUs where IDAboutUs = @id",
                     new string[] { "@id" }, new object[] { id }, CommandType.Text);
             }
             catch (Exception ex)
             {
                 throw ex;
             }
             return dt;
         }

         public DataTable GetAll()
         {
              DataTable dt = null;
              try
              {
                  dt = _db.ExeSP_DataTable("select * from TblAboutUs", false, CommandType.Text);
              }
              catch (Exception ex)
              {
                  throw ex;
              }
              return dt;
         }

    }
}
